package com.wwj.controller;

import com.wwj.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

@Controller
public class ExecuteController {
    @RequestMapping("/execute")
    public String execute(Map<String,Object> map){
        map.put("name", "jj");
        map.put("msg","<h1>吃饭了</h1>");
        return "success";

    }

    @RequestMapping("/test")
    public String test(Model model){
       model.addAttribute("users", Arrays.asList("wwj","kk","vv"));
        return "success";

    }
    @RequestMapping("/study")
    public String study(Map<String, Object> map, HttpServletRequest request){
        List<User> userList = new ArrayList<>();
        userList.add(new User("蔡文姬",12));
        userList.add(new User("瑶",16));
        userList.add(new User("小明",14));
        map.put("userList",userList);

        map.put("sex",1);
        map.put("man",2);

        map.put("desc","好好学习啊<h1>静静</h1>");
        return "study";






    }







}
